package com.shd.edanpei.bean;

import android.text.TextUtils;

import com.shd.edanpei.common.Constant;
import com.shd.edanpei.enums.GenderEnum;
import com.shd.edanpei.enums.OrderTypeEnum;
import com.shd.edanpei.enums.StatusEnum;
import com.shd.edanpei.util.DateUtils;

/**
 * Created by mc on 2018/9/25.
 * yang-wen-wen
 */

public class OrderListModel {

    /**
     * againTime : 0
     * applyAmount : 60
     * applyInterest : 4.7—5.2厘
     * applyRepaymentType : 随借随还
     * applyTerm : 1年
     * createTime : 1537836330000
     * createUserId : 57
     * customerId : 52
     * customerName : 恶露
     * isPayDeposit : false
     * isPayService : false
     * mobile : 1855736888
     * orderId : 31
     * orderNo : 18092528000337084526
     * orderSource : 0
     * orderStatus : 1
     * orderType : 2
     * remark : bdhhdjdjd
     * userStatus : 1
     */

    private int againTime;
    private String applyAmount;
    private String applyInterest;
    private String applyRepaymentType;
    private String applyTerm;
    private long createTime;
    private int createUserId;
    private int customerId;
    private String customerName;
    private boolean isPayDeposit;
    private boolean isPayService;
    private String mobile;
    private int orderId;
    private String orderNo;
    private int orderSource;
    private int orderType;
    private String remark;
    private int userStatus;
    private String area;
    private int sex;
    private boolean isMarrage;
    private int age;
    private int managerStatus;
    private String loanCreditPath;
    private String createUserName;
    private String avatarUrl;
    private int managerId;
    private String estimatedRevenue;

    public int getAgainTime() {
        return againTime;
    }

    public String getApplyAmount() {
        return applyAmount + Constant.Unit.WANYUAN.getUnit();
    }

    public String getAmount() {
        return applyAmount;
    }

    public String getApplyInterest() {
        return applyInterest;
    }

    public String getApplyRepaymentType() {
        return applyRepaymentType;
    }

    public String getApplyTerm() {
        return applyTerm;
    }

    public String getCreateTime() {
        return DateUtils.formatTime(createTime, Constant.Time.YYYY_MM_DD_HH_MM_SS.getTime());
    }

    public int getCreateUserId() {
        return createUserId;
    }

    public int getCustomerId() {
        return customerId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public String getCustomerName2() {
        return TextUtils.isEmpty(customerName) ? "" : customerName.substring(0, 1) + "**";
    }


    public String getCreateUserName(OrderListModel orderListModel) {
        if(orderListModel.getOrderType()== OrderTypeEnum.house.getKey()){
            if (!TextUtils.isEmpty(createUserName)) {
                return createUserName.substring(0, 1) + "**发布住房订单";
            }
        }else if(orderListModel.getOrderType()== OrderTypeEnum.car.getKey()){
            if (!TextUtils.isEmpty(createUserName)) {
                return createUserName.substring(0, 1) + "**发布车辆订单";
            }

        }else if(orderListModel.getOrderType()== OrderTypeEnum.personal.getKey()){
            if (!TextUtils.isEmpty(createUserName)) {
                return createUserName.substring(0, 1) + "**发布个人信用订单";
            }

        }else if(orderListModel.getOrderType()== OrderTypeEnum.enterprise.getKey()){
            if (!TextUtils.isEmpty(createUserName)) {
                return createUserName.substring(0, 1) + "**发布企业税金订单";
            }
        }
            return "***发布住房订单";

    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public boolean isIsPayDeposit() {
        return isPayDeposit;
    }

    public boolean isIsPayService() {
        return isPayService;
    }

    public String getMobile() {
        return mobile;
    }

    public int getOrderId() {
        return orderId;
    }


    public String getOrderNo() {
        return orderNo;
    }

    public int getOrderSource() {
        return orderSource;
    }

    public int getOrderType() {
        return orderType;
    }

    public String getRemark() {
        return remark;
    }

    public int getUserStatus() {
        return userStatus;
    }

    public String getArea() {
        if(area==null||area.length()==0){
            area="浙江省杭州滨江区";
        }
        return area;
    }


    public void setArea(String area) {
        this.area = area;
    }

    public String getInfo() {
        return GenderEnum.getGender(sex) + " " + age + "岁 " + (isMarrage ? "已婚" : "未婚");
    }

    public int getManagerStatus() {
        return managerStatus;
    }

    public void setManagerStatus(int managerStatus) {
        this.managerStatus = managerStatus;
    }

    public void setUserStatus(int userStatus) {
        this.userStatus = userStatus;
    }

    public String getLoanCreditPath() {
        return loanCreditPath;
    }

    public void setLoanCreditPath(String loanCreditPath) {
        this.loanCreditPath = loanCreditPath;
    }

    public String getPayType() {
        if (userStatus == StatusEnum.unpaid.getStatus()) {
            return "押金";
        } else if (userStatus == StatusEnum.waitService.getStatus()) {
            return "服务费";
        }
        return "";
    }

    public String getPayHint() {
        if (userStatus == StatusEnum.unpaid.getStatus()) {
            return "1.该押金为订单押金，可随时退还\n2.押金退还时间为1—7个工作日";
        } else if (userStatus == StatusEnum.waitService.getStatus()) {
            return "1.该服务费为平台服务费\n2.服务费到账时间以后台收款时间为准";
        }
        return "";
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }


    public int getManagerId() {
        return managerId;
    }

    public String getEstimatedRevenue() {
        return estimatedRevenue + "积分";
    }
}


